{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "CDO Tranche Pricing Using Vasicek Simulator and \n",
    "-------------------\n",
    "\n",
    "The par spread $S$ of a CDS tranche is given by\n",
    "$$S = \\frac{\\text{Protection Leg PV}}{\\text{RPV01}},$$\n",
    "\n",
    "where\n",
    "$$\\begin{aligned}\n",
    "\\text{RPV01} &= \\sum_{i} \\Delta_i Z(t_i) \\frac{Q(t_{i-1},K_1,K_2) + Q(t_i, K_1, K_2)}{2} \\\\\n",
    "\\text{Protection Leg PV} &= \\int_{0}^{T} Z(t) (-dQ(t,K_1,K_2))\n",
    "\\end{aligned}$$\n",
    "\n",
    "Here, \n",
    "\n",
    "* $K_1, K_2, T$ is the tranche starting level, final level, and maturity, respectively.\n",
    "* $Z(t)$ is the discount factor curve.\n",
    "* $Q(t,K_1,K_2)$ is the tranche survival curve: $Q(t,K_1,K_2)= 1 - \\frac{f(t, K_2) - f(t, K_1)}{K_2 - K_1}$\n",
    "* $t_i$ is the time of the $i^{th}$ premium payment. And $\\Delta_i$ is the time-fraction of the $i^{th}$\n",
    "  interval, using the Act365 DCF.\n",
    " \n",
    "  \n",
    "And $f(t,K) = E[ \\min (L(t),K)]$ is model-dependent.\n",
    "\n",
    "With the exception for the formula of $Q$, the CDO tranche pricing formula is identical to\n",
    "the CDS pricing formula with $R=0$. So we first define a class for calculating CDS's."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    ""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2.0
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}